﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Rison.Web.Common;
using Rison.BusinessFacade.Common;
using Rison.BusinessFacade.Helper;
using Rison.BusinessFacade.Facade.Biz;

namespace Rison.Web.ascx
{
    public partial class FlashLinkImage : System.Web.UI.UserControl
    {

        protected string UrlBase
        {
            get { return Rison.Web.Common.PageGlobalParams.PageUrlBase2; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                hidDIDs.Value = string.Empty;


                InfosReaderFacade facade = new InfosReaderFacade("jftp");//纠风图片
                //5  --》6
                //DataSet dsImages = facade.ReadNewsInfos(5, 15, false); facade = null;
                DataSet dsImages = facade.ReadNewsInfos(6, 15, false); facade = null;

                int i = 0;
                foreach (DataRow row in dsImages.Tables[0].Rows)
                {
                    if (row["MediaFileName"].ToString().StartsWith("/"))
                        row["MediaFileName"] = GlobalParams.Instance.NewsImageBaseUrl + row["MediaFileName"].ToString();
                    else
                        row["MediaFileName"] = GlobalParams.Instance.NewsImageBaseUrl + "/" + row["MediaFileName"].ToString();

                    if (!string.IsNullOrEmpty(hidDIDs.Value)) hidDIDs.Value += ";";
                    hidDIDs.Value += row["infoId"].ToString();

                    if (!string.IsNullOrEmpty(hidAlts.Value)) hidAlts.Value += "$$";
                    hidAlts.Value += row["Title"].ToString();

                    i++;
                    if (i > 6)
                        break;
                    else if (i == 1)
                        this.hidImgSrc1.Value = row["MediaFileName"].ToString();
                    else if (i == 2)
                        this.hidImgSrc2.Value = row["MediaFileName"].ToString();
                    else if (i == 3)
                        this.hidImgSrc3.Value = row["MediaFileName"].ToString();
                    else if (i == 4)
                        this.hidImgSrc4.Value = row["MediaFileName"].ToString();
                    else if (i == 5)
                        this.hidImgSrc5.Value = row["MediaFileName"].ToString();
                    else if (i == 6)
                        this.hidImgSrc6.Value = row["MediaFileName"].ToString();
                }
                dsImages = null;

                //下段代码，在数据库中没有上传文件时，支持直接在后台文件夹中放入文件，文件名限定为1\2\3\4 
                if (string.IsNullOrEmpty(hidImgSrc1.Value))
                    hidImgSrc1.Value = PageGlobalParams.PageUrlBase2 + "/file/image/home/党风廉政大会图片1.jpg";
                if (string.IsNullOrEmpty(hidImgSrc2.Value))
                    hidImgSrc2.Value = PageGlobalParams.PageUrlBase2 + "/file/image/home/党风廉政大会图片2.jpg";
                if (string.IsNullOrEmpty(hidImgSrc3.Value))
                    hidImgSrc3.Value = PageGlobalParams.PageUrlBase2 + "/file/image/home/党风廉政大会图片3.jpg";
                if (string.IsNullOrEmpty(hidImgSrc4.Value))
                    hidImgSrc4.Value = PageGlobalParams.PageUrlBase2 + "/file/image/home/党风廉政大会图片1.jpg";
                if (string.IsNullOrEmpty(hidImgSrc5.Value))
                    hidImgSrc5.Value = PageGlobalParams.PageUrlBase2 + "/file/image/home/党风廉政大会图片2.jpg";
                if (string.IsNullOrEmpty(hidImgSrc6.Value))
                    hidImgSrc6.Value = PageGlobalParams.PageUrlBase2 + "/file/image/home/党风廉政大会图片3.jpg";


               
            }
        }

    }
}